<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;

class Comment extends Model
{
    use Common;

    protected $table = 'comment';



    /**
     * 用户
     * @return BelongsTo
     * @Author 姿势就是力量
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }


    /**
     * 司机
     * @return BelongsTo
     * @Author 姿势就是力量
     */
    public function driver()
    {
        return $this->belongsTo(User::class, 'driver_id', 'id');
    }


    /**
     * 所属公司
     * @return BelongsTo
     * @Author 姿势就是力量
     */
    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id', 'id');
    }


    /**
     * 业务类型
     * @return BelongsTo
     * @Author 姿势就是力量
     */
    public function service()
    {
        return $this->belongsTo(Service::class, 'service_id', 'id');
    }

    /**关联订单
     * @return belongsTo
     * @author Bob(bobcoder@qq.com)
     */
    public function orders()
    {
        return $this->belongsTo(Orders::class,'order_id','id');
    }
}
